/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities.pos;

import com.giant.authentication.User;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author david
 */
@Entity
@Table(name = "p_invoice_seller")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PInvoiceSeller.findAll", query = "SELECT p FROM PInvoiceSeller p"),
    @NamedQuery(name = "PInvoiceSeller.findByIdInvoiceSeller", query = "SELECT p FROM PInvoiceSeller p WHERE p.idInvoiceSeller = :idInvoiceSeller")})
public class PInvoiceSeller implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_invoice_seller")
    private Integer idInvoiceSeller;
    @JoinColumn(name = "id_invoice", referencedColumnName = "id_invoice")
    @ManyToOne(optional = false)
    private PInvoice idInvoice;
    @OneToOne
    @JoinColumn(name="id_seller")
    private User idSeller;

    public PInvoiceSeller() {
    }

    public PInvoiceSeller(Integer idInvoiceSeller) {
        this.idInvoiceSeller = idInvoiceSeller;
    }

    public Integer getIdInvoiceSeller() {
        return idInvoiceSeller;
    }

    public void setIdInvoiceSeller(Integer idInvoiceSeller) {
        this.idInvoiceSeller = idInvoiceSeller;
    }

    public PInvoice getIdInvoice() {
        return idInvoice;
    }

    public void setIdInvoice(PInvoice idInvoice) {
        this.idInvoice = idInvoice;
    }

    public User getIdSeller() {
        return idSeller;
    }

    public void setIdSeller(User idSeller) {
        this.idSeller = idSeller;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInvoiceSeller != null ? idInvoiceSeller.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PInvoiceSeller)) {
            return false;
        }
        PInvoiceSeller other = (PInvoiceSeller) object;
        if ((this.idInvoiceSeller == null && other.idInvoiceSeller != null) || (this.idInvoiceSeller != null && !this.idInvoiceSeller.equals(other.idInvoiceSeller))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.PInvoiceSeller[ idInvoiceSeller=" + idInvoiceSeller + " ]";
    }
    
}
